#lang rosetta-racket


(require "pillow.rkt")

(provide pillow-even-odd-example
         pillow-shell-example
         pillow-odd-even-shell-example
         pillow-sharp-shell-example
         pillow-continuous-example
         pillow-odd-even-continuous-example)


(define (pillow-even-odd-example)
  (let ((shape (pillow
                1.5
                1
                1.4
                20
                (λ (cr sr br n i)
                  (if (even? i)
                      (circle sr)
                      (circle br))))))
    (view
     (xyz 3.731266570865907 -3.7489871638547907 3.0357433408155776)
     (xyz -0.4987816393648039 0.4810610463759204 -1.1943048694151486)
     (perspective 35)
     shape)))

(define (pillow-shell-example)
  (let ((shape (pillow
                5
                0.2
                1.4
                20
                (λ (cr sr br n i)
                  (circle (* (+ i 0.5) sr))))))
    (view
     (xyz -4.684921274629514 10.174578985088914 7.917128721502907)
     (xyz -0.8624878873156663 0.6643234084168033 0.3168355562219376)
     (perspective 35)
     shape)))

(define (pillow-odd-even-shell-example)
  (let ((shape (pillow
                10
                0.2
                0.28
                20
                (λ (cr sr br n i)
                  (if (even? i)
                      (circle (* (+ i 0.5) sr))
                      (circle (* i br)))))))
    (view
     (xyz -7.846427427275996 18.040440459268357 14.203274526868633)
     (xyz -0.8624878873156663 0.6643234084168033 0.3168355562219376)
     (perspective 35)
     shape)))

(define (pillow-sharp-shell-example)
  (let ((shape (pillow
                50
                0.2
                0.4
                80
                (λ (cr sr br n i)
                  (if (even? i)
                      (circle (* (+ i 0.5) sr))
                      (circle (* i br)))))))
    (view
     (xyz -44.3659262777543 96.14814070885043 77.12985077076827)
     (xyz -5.438198075076355 -0.7044677513467068 -0.27166722053415754)
     (perspective 35)
     shape)))

(define (pillow-continuous-example)
  (let ((shape (pillow
                1.5
                0.2
                0.4
                50
                (λ (cr sr br n i)
                  (circle (+ (* (sin (* (/ i n) 2pi)) sr) sr))))))
    (view
     (xyz 1.243590228324302 -2.8307406655002327 1.3656730235935644)
     (xyz 0.11817148697514557 -0.11373947678623743 -0.05483169009100459)
     (perspective 35)
     shape)))

(define (pillow-odd-even-continuous-example)
  (let ((shape (pillow
                1.5
                0.4
                0.5
                40
                (λ (cr sr br n i)
                  (if (even? i)
                      (circle (+ (* (sin (* (/ i n) 2pi)) sr) 0.5))
                      (circle (+ (* (sin (* (/ i n) 2pi)) br) 0.5)))))))
    (view
     (xyz 1.5294551880745353 -3.2132761120162407 1.5810648400471472)
     (xyz 0.2281484014981444 -0.07164361905536368 -0.061445948484309905)
     (perspective 35)
     shape)))